package cn.golxen.user.service.impl;

import cn.golxen.user.entity.User;
import cn.golxen.user.mapper.UserMapper;
import cn.golxen.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public Integer addUser(User user) {
        if (userMapper.selectUserById(user.getUserId())!=null)
            return 0;
        else {
            return userMapper.addUser(user);
        }

    }

    @Override
    public User selectUserById(String userId) {
        return userMapper.selectUserById(userId);
    }


    @Override
    public boolean userLogin(User user) {
        return userMapper.userLogin(user) != null;

    }
}
